<html>
    <script>
        function Person(){
            this.name = '张三';
            this.age = '222';
            this.sex = '不详';
            this.greet = function(){
                alert(this.name + '人送外号法外狂徒')
            }
        }
    </script>
    <body>
        <a href="#" onclick="createperson();">创建对象，并访问</a>
    </body>
    <script>
        function createperson(){
            var person = new Person();
            alert("名字：" + person.name);
            person.greet();
        }
    </script>
</html>